package cn.roderick.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class LoggingAspect{

    @Before("execution(public * cn.roderick.aop.Customer.addCustomer(..))")
    public void logBefore(JoinPoint joinPoint){
        System.out.println("logBefore() is running ...");
        System.out.println("LoggingAspect:"+ joinPoint.getSignature().getName());
        System.out.println("**********");
    }

    @After("execution(public * cn.roderick.aop.Customer.deleteCustomer(..))")
    public void logAfter(JoinPoint joinPoint){
        System.out.println("logAfter() is running ...");
        System.out.println("LoggingAspect:"+ joinPoint.getSignature().getName());
        System.out.println("**********");
    }
}